package niuke.jianZhiOffer;

import java.util.Scanner;

/**
 * Created by Administrator on 2018/5/20.
 */
public class ReplaceSpace {
    public static String replaceSpace(String str){
        if (str == null){
            return "-1";
        }
        int flag = 0;
        StringBuffer newstring = new StringBuffer();
        StringBuffer oldstring = new StringBuffer(str);
        for(int i=0;i<oldstring.length();i++){
            if(oldstring.charAt(i) == ' '){
                if(flag == 0) {
//                    newstring.append(new char[]{'%', '0', '%'});
                    newstring.append("%%");
                    flag =1;
                }
            }else{
                newstring.append(oldstring.charAt(i));
                flag = 0;
            }
        }
        return newstring.toString();
    }

    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        String arr = input.nextLine();
        System.out.println(arr);
        System.out.println(replaceSpace(arr));
    }
}
